﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Dune2013
{
    public class Node
    {
        public enum NODE_TYPE { NOTHING,EMPTY, POI, BASE, STATION, WELL, BUILDING_WELL, OBSTACULE};
        public enum LISTS { NONE, OPEN, CLOSE };
        public bool obstacle;
        public int f, g, h;
        public LISTS whichList;
        public Node from;
        public Vector2 mapPosition;
        public float difficulty = 1.0f;
        public NODE_TYPE type = NODE_TYPE.NOTHING;
        private Texture2D tex;
        public float scale = 1.0f;
        
        //TODO pasar oil a subclase.
        public int oil;

        public Node(int x, int y, float scale)
        {
            mapPosition = new Vector2(x, y);
            this.scale = scale;
        }
        public void makeOpen(int _g, int _h)
        {
            whichList = LISTS.OPEN;
            f = _g+_h;
            g = _g;
            h = _h;
        }
        public Texture2D getTexture() {
            if (tex == null) {
                tex = NodeManager.getInstance().getAppropiateTexture(this);
            }
            return tex;
        }
        public void emptyTexture() {
            tex = null;
        }
    }
}
